X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/95d7601b7742ed560a9d8e00269217f62fc7ce32..74c155708d85abfc2cf227c08de4f27003015b3f:/Super%20Polarity/SuperPolarity.cs
diff --git a/Super Polarity/SuperPolarity.cs b/Super Polarity/SuperPolarity.cs
index c43582e..6689167 100644
--- a/Super Polarity/SuperPolarity.cs
+++ b/Super Polarity/SuperPolarity.cs
@@ -17,21 +17,33 @@ namespace SuperPolarity
///
public class SuperPolarity : Game
{
- public static GraphicsDeviceManager graphics;
+ public GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
- // Input Handler
- KeyboardState currentKeyboardState;
- GamePadState currentGamePadState;
+ public static int OutlierBounds;
- MainShip player;
+ public Player Player;
+
+ Screen EntryScreen;
+
+ SpriteFont DebugFont;
public SuperPolarity()
: base()
{
- SuperPolarity.graphics = new GraphicsDeviceManager(this);
- SuperPolarity.graphics.PreferMultiSampling = true;
+ graphics = new GraphicsDeviceManager(this);
+ graphics.PreferMultiSampling = true;
+ graphics.PreferredBackBufferWidth = 1280;
+ graphics.PreferredBackBufferHeight = 720;
+ graphics.ToggleFullScreen();
+
Content.RootDirectory = "Content";
+ ActorFactory.SetGame(this);
+ ParticleEffectFactory.SetGame(this);
+ ActorManager.SetGame(this);
+ ScreenManager.SetGame(this);
+
+ EntryScreen = (Screen)new GameScreen(this);
}
///
@@ -42,9 +54,21 @@ namespace SuperPolarity
///
protected override void Initialize()
{
- player = new MainShip();
-
base.Initialize();
+
+ InputController.RegisterEventForKey("fullScreenToggle", Keys.F11);
+ InputController.Bind("fullScreenToggle", HandleFullScreenToggle);
+
+ EntryScreen.Initialize();
+ ScreenManager.Push(EntryScreen);
+
+ OutlierBounds = 100;
+ }
+
+ protected void HandleFullScreenToggle(float value)
+ {
+ graphics.ToggleFullScreen();
+ graphics.ApplyChanges();
}
///
@@ -56,9 +80,10 @@ namespace SuperPolarity
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
- Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
+ EntryScreen.LoadContent();
- player.Initialize(Content, Content.Load("Graphics\\main-ship"), playerPosition);
+ Player = new Player();
+ DebugFont = Content.Load("Fonts\\SegoeUIMono14");
}
///
@@ -80,10 +105,7 @@ namespace SuperPolarity
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
- // TODO: Add your update logic here
-
- InputController.UpdateInput();
- player.Update(gameTime);
+ ScreenManager.Update(gameTime);
base.Update(gameTime);
}
@@ -98,7 +120,11 @@ namespace SuperPolarity
spriteBatch.Begin();
- player.Draw(spriteBatch);
+ ScreenManager.Draw(spriteBatch);
+
+ spriteBatch.DrawString(DebugFont, "Score: " + Player.Score.ToString(), new Vector2(10, 10), Color.LightGray);
+ spriteBatch.DrawString(DebugFont, "Multiplier: " + Player.Multiplier.ToString(), new Vector2(10, 30), Color.LightGray);
+ spriteBatch.DrawString(DebugFont, "Lives: " + Player.Lives.ToString(), new Vector2(10, 50), Color.LightGray);
spriteBatch.End();